package com.example.dormitory_system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.dormitory_system.domain.enetiy.ChangeRoom;
import com.example.dormitory_system.domain.vo.student.ChangeRoomVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ChangeRoomMapper extends BaseMapper<ChangeRoom> {

//    List<ChangeRoomVO> selectChangeRoomsWithBuildingAndRoomNames(@Param("studentId") Long studentId);

    ChangeRoomVO selectChangeRoomWithNewBuildingAndRoomNames(@Param("changeRoomId") Long changeRoomId, @Param("studentId") Long studentId);

    List<ChangeRoomVO> selectChangeRoomsWithStudent(@Param("applyname") String applyname,@Param("status") Integer status,@Param("number") String number);

    @Select("SELECT cr.*,u.name FROM tb_change_room cr join tb_user u on cr.user_id = u.user_id where cr.student_id = #{studentId}")
    List<ChangeRoomVO> listRoom(Long studentId);

    List<ChangeRoomVO> selectChangeRoomsWithStudent2(Integer status, String name, String username, Long userId);

}